 // 单位数补0
 function change(t){
 	if(t<10){
 	 return "0"+t;
 	}else{
 	 return t;
 	}
 }
 // 当前时间
function formDate(){
	setInterval(function(){
		var d=new Date();
		var year=d.getFullYear();
		var month= change(d.getMonth()+1);
		var day= change(d.getDate());
		var hour= change(d.getHours());
		var minute= change(d.getMinutes());
		var second= change(d.getSeconds());
		var time=year+'-'+month+'-'+day+' '+hour+':'+minute+':'+second;
		var weekarr = ["日", "一", "二", "三", "四", "五", "六"]; 
		var key=d.getDay()
		document.getElementById('riqi').innerHTML=year+' 年 '+month+' 月 '+day+' 日  星期'+weekarr[key]
		document.getElementById('shijian').innerHTML=hour+':'+minute+':'+second
	},1000)			
}
// 全屏
function full(){
	var docElm = document.documentElement;
	//W3C 
	if (docElm.requestFullscreen) { 
		docElm.requestFullscreen(); 
	}
	//FireFox 
	else if (docElm.mozRequestFullScreen) { 
		docElm.mozRequestFullScreen(); 
	}
	//Chrome等 
	else if (docElm.webkitRequestFullScreen) { 
		docElm.webkitRequestFullScreen(); 
	}
	//IE11
	else if (elem.msRequestFullscreen) {
	  elem.msRequestFullscreen();
	}
	
	if (document.exitFullscreen) { 
		document.exitFullscreen(); 
	} 
	else if (document.mozCancelFullScreen) { 
		document.mozCancelFullScreen(); 
	} 
	else if (document.webkitCancelFullScreen) { 
		document.webkitCancelFullScreen(); 
	}
	else if (document.msExitFullscreen) {
		  document.msExitFullscreen();
	}
	
}

// 向上滚动函数
function topScroll(enType,steep) { //滚动效果函数
  var noticeListH = $(enType+" li").height(), //获取滚动的li的高度
	noticeH = $(enType).parent().height(), //获取展示区域的高度
	noticeHListNum = Math.ceil(noticeH / noticeListH), //获取展示区域一共可以展示多少条数据,这里是因为布局的原因才*2的如果一行只有一个不需要*2
	listNum = $(enType+" li").length;
  if(listNum > noticeHListNum) {
	$(enType).animate({
	  'marginTop':-noticeListH+'px'
	},steep,'swing',function() { //当动画结束直接回调下面的函数
	  $(enType+' li:first').appendTo($(enType));
	  $(enType).css({'marginTop':'0'+'px'});
	});
  }
}
// 右侧各项成本
function huafei(res){
	$('.huafei').html('')
	for(var i in res){
		$('.huafei').append(`
			<li>
				<p>
					<span><img src="img/${res[i]['icon']}.png" alt=""></span>
					<span>${i}</span>
					<span>${res[i]['num']}元/${res[i]['process']}</span>
				</p>
			</li>
		`)
	}
}
// 右侧表格1(任务展示)
function table1(table1){
	$('.table1 .th').html('')
	table1['title'].forEach(function(item){
		$('.table1 .th').append(`
			<span class="s1">${item}</span>
		`)
	})
	$('.scroll2').html('')
	table1['data'].forEach(function(item1,key1){
		$('.scroll2').append(`
			<li class="tr ${key1%2==0? 'item1':'item2'}">
				<span class="s1">${item1[0]}</span>
				<span class="s2">${item1[1]}</span>
				<span class="s3">${item1[2]}</span>
				<span class="s4">${item1[3]}</span>
				<span class="s5">${item1[4]}</span>
				<span class="s4">${item1[5]}</span>
				<span class="s5">${item1[6]}</span>
				<span class="s5">${item1[7]}</span>
				<span class="s5">${item1[8]}</span>
				<span class="s5">${item1[9]}</span>
				<span class="s5">${item1[10]}</span>
			</li>
		`)
	})
	// 右侧滚动1
	var timer22 = setInterval(function() {
		topScroll(".scroll2",1000);
	},3000);
	$('.scroll2 li').on('mouseover',function(){
		clearInterval(timer22)
	})
	$('.scroll2 li').on('mouseout',function(){
		timer22 = setInterval(function() {
			topScroll(".scroll2",1000);
		},3000);
	})
}
// 中间折线图
var myChart1 = echarts.init(document.getElementById('echart1'));
function ech1(res){
	var series=[];
	 for(var i in res.data){
		series.push(
		{
		    name: i,
		    type: 'line',
		    smooth: true,
			animation:true,
			symbolSize:8,
			symbol: 'circle',
			showSymbol: true,
			lineStyle:{
				color:res['data'][i]['col'],
				normal:{
					shadowBlur: 10,
					shadowOffsetX: 0,
					shadowColor: 'rgba(255, 255, 255, 0.5)'
				}
			},
		    areaStyle: {
		        color: res['data'][i]['acol']
		    },
		    data:res['data'][i]['shuju']
		}
		)
	}
	option1 = {
	    tooltip: {
	        trigger: 'axis',
	        axisPointer: {
	            type: 'shadow',
	            label: {
	                backgroundColor: '#6a7985'
	            }
	        }
	    },
		dataZoom: [{
			type: 'inside',
			start: 0,
			end: 100
		},],
		color:res.col,
	    legend: {
			top:"3%",
	        data: res.names,
			formatter: (params) => {  //格式化数据的函数
				for (let a = 0; a < option1.series.length; a++) {
					if (option1.series[a].name == params) {
						 var total=0
						 for(var num of option1.series[a].data){
							total+= num
						 }
						  return params
					}
				}
			}
	    },
	    grid: {
			top:"15%",
	        left: '2%',
	        right: '2%',
	        bottom: '3%',
	        containLabel: true
	    },
	    xAxis: {
	            type: 'category',
	            boundaryGap: false,
				axisLabel: {
					textStyle:{
						color:'#5fccff',  //坐标的字体颜色
						fontSize:14
					},
					formatter: '{value}'
				},
				splitLine:{
					 lineStyle: {
						 type: 'solid',
						 color: '#25315c'
					 }
				 },
	            data: res.datax
		},
	    yAxis:{
			name:'毛利率/%',
			 nameTextStyle:{
				color:"#5fccff", 
				fontSize:16
			},
			type: 'value',
			axisLabel: {
				textStyle:{
					color:'#5fccff',  //坐标的字体颜色
					fontSize:14
				}
			},
			splitLine:{
				 show: true,
				 lineStyle: {
					 type: 'solid',
					 color: '#25315c'
				}
			},
		},
	    series: series
	};
	myChart1.setOption(option1,true);
	myChart1.setOption(option1);
	lub(myChart1,data1,option1)	
}
// tooltip自动轮播
var timeId3=null
function lub(myChart1,data1,option1){
	var currentIndex = -1;
	timeId3&&clearInterval(timeId3)
	var dataLen = data1.length;
	timeId3=setInterval(function () {
		// 取消之前高亮的图形
		myChart1.dispatchAction({
		  type: 'downplay',
		  seriesIndex: 0,
		  dataIndex: currentIndex
		});
		currentIndex = (currentIndex + 1) % dataLen;
		$('.xc1').html(option1.xAxis.data[currentIndex])
		$('.xc2').html(option1.xAxis.data[currentIndex])
		$('.xc3').html(option1.xAxis.data[currentIndex])
		//console.log(app.currentIndex);
		// 高亮当前图形
		myChart1.dispatchAction({
		  type: 'highlight',
		  seriesIndex: 0,
		  dataIndex: currentIndex,
		});
		// 显示 tooltip
		myChart1.dispatchAction({
		  type: 'showTip',
		  seriesIndex: 0,
		  dataIndex: currentIndex
		});
		var data41=[
			{'name':'原材料','value':Math.floor((Math.random()+Math.random())*100)},
			{'name':'油耗','value':Math.floor((Math.random()+Math.random())*100)},
			{'name':'辅料','value':Math.floor((Math.random()+Math.random())*100)},
			{'name':'司机提成','value':Math.floor((Math.random()+Math.random())*100)},
			{'name':'损耗','value':Math.floor((Math.random()+Math.random())*100)},
			{'name':'人工','value':Math.floor((Math.random()+Math.random())*100)},
			{'name':'电费','value':Math.floor((Math.random()+Math.random())*100)},
			{'name':'其他','value':Math.floor((Math.random()+Math.random())*100)}
		]
		edata4.data=data41
		ech4(edata4)
		var data21=[
			{value: Math.floor((Math.random()+Math.random())*100), name: '水泥金额'},
			{value: Math.floor((Math.random()+Math.random())*100), name: '细骨料金额'},
			{value: Math.floor((Math.random()+Math.random())*100), name: '粗骨料金额'},
			{value: Math.floor((Math.random()+Math.random())*100), name: '水金额'},
			{value: Math.floor((Math.random()+Math.random())*100), name: '外加剂金额'},
			{value: Math.floor((Math.random()+Math.random())*100), name: '掺合料金额'},
			{value: Math.floor((Math.random()+Math.random())*100), name: '水泥金额1'},
			{value: Math.floor((Math.random()+Math.random())*100), name: '细骨料金额1'},
			{value: Math.floor((Math.random()+Math.random())*100), name: '粗骨料金额1'},
			{value: Math.floor((Math.random()+Math.random())*100), name: '水金额1'},
			{value: Math.floor((Math.random()+Math.random())*100), name: '外加剂金额1'},
			{value: Math.floor((Math.random()+Math.random())*100), name: '掺合料金额1'}
		]
		edata2.data=data21
		ech2(edata2)
		var datan=[
			Math.floor((Math.random()+Math.random())*1000),
			Math.floor((Math.random()+Math.random())*1000),
			Math.floor((Math.random()+Math.random())*1000),
			Math.floor((Math.random()+Math.random())*1000),
			Math.floor((Math.random()+Math.random())*1000),
			Math.floor((Math.random()+Math.random())*1000),
			Math.floor((Math.random()+Math.random())*1000),
			Math.floor((Math.random()+Math.random())*1000)
		]
		cdata={
			'原材料':{
				'num':Math.floor((Math.random()+Math.random())*1000),
				'process':((Math.random()+Math.random())*1000/100).toFixed(1)+'%',
				'icon':'ico1'
			},
			'油耗':{
				'num':Math.floor((Math.random()+Math.random())*1000),
				'process':((Math.random()+Math.random())*1000/100).toFixed(1)+'%',
				'icon':'ico2'
			},
			'辅料':{
				'num':Math.floor((Math.random()+Math.random())*1000),
				'process':((Math.random()+Math.random())*1000/100).toFixed(1)+'%',
				'icon':'ico3'
			},
			'司机提成':{
				'num':Math.floor((Math.random()+Math.random())*1000),
				'process':((Math.random()+Math.random())*1000/100).toFixed(1)+'%',
				'icon':'ico4'
			},
			'损耗':{
				'num':Math.floor((Math.random()+Math.random())*1000),
				'process':((Math.random()+Math.random())*1000/100).toFixed(1)+'%',
				'icon':'ico5'
			},
			'人工':{
				'num':Math.floor((Math.random()+Math.random())*1000),
				'process':((Math.random()+Math.random())*1000/100).toFixed(1)+'%',
				'icon':'ico6'
			},
			'电费':{
				'num':Math.floor((Math.random()+Math.random())*1000),
				'process':((Math.random()+Math.random())*1000/100).toFixed(1)+'%',
				'icon':'ico7'
			},
			'其他':{
				'num':Math.floor((Math.random()+Math.random())*1000),
				'process':((Math.random()+Math.random())*1000/100).toFixed(1)+'%',
				'icon':'ico8'
			}
		}
		$('.huafei').html('')
		for(var i in cdata){
			$('.huafei').append(`
				<li>
					<p>
						<span><img src="img/${cdata[i]['icon']}.png" alt=""></span>
						<span>${i}</span>
						<span>${cdata[i]['num']}元/${cdata[i]['process']}</span>
					</p>
				</li>
			`)
		}
	}, 2000);
	myChart1.on('mouseover', function (params) {
		clearInterval(timeId3);
		$('.xc1').html(params.name)
		$('.xc2').html(params.name)
		$('.xc3').html(params.name)
		var data41=[
			{'name':'原材料','value':Math.floor((Math.random()+Math.random())*100)},
			{'name':'油耗','value':Math.floor((Math.random()+Math.random())*100)},
			{'name':'辅料','value':Math.floor((Math.random()+Math.random())*100)},
			{'name':'司机提成','value':Math.floor((Math.random()+Math.random())*100)},
			{'name':'损耗','value':Math.floor((Math.random()+Math.random())*100)},
			{'name':'人工','value':Math.floor((Math.random()+Math.random())*100)},
			{'name':'电费','value':Math.floor((Math.random()+Math.random())*100)},
			{'name':'其他','value':Math.floor((Math.random()+Math.random())*100)}
		]
		edata4.data=data41
		ech4(edata4)
		var data21=[
			{value: Math.floor((Math.random()+Math.random())*100), name: '水泥金额'},
			{value: Math.floor((Math.random()+Math.random())*100), name: '细骨料金额'},
			{value: Math.floor((Math.random()+Math.random())*100), name: '粗骨料金额'},
			{value: Math.floor((Math.random()+Math.random())*100), name: '水金额'},
			{value: Math.floor((Math.random()+Math.random())*100), name: '外加剂金额'},
			{value: Math.floor((Math.random()+Math.random())*100), name: '掺合料金额'},
			{value: Math.floor((Math.random()+Math.random())*100), name: '水泥金额1'},
			{value: Math.floor((Math.random()+Math.random())*100), name: '细骨料金额1'},
			{value: Math.floor((Math.random()+Math.random())*100), name: '粗骨料金额1'},
			{value: Math.floor((Math.random()+Math.random())*100), name: '水金额1'},
			{value: Math.floor((Math.random()+Math.random())*100), name: '外加剂金额1'},
			{value: Math.floor((Math.random()+Math.random())*100), name: '掺合料金额1'}
		]
		edata2.data=data21
		ech2(edata2)
		var datan=[
			Math.floor((Math.random()+Math.random())*1000),
			Math.floor((Math.random()+Math.random())*1000),
			Math.floor((Math.random()+Math.random())*1000),
			Math.floor((Math.random()+Math.random())*1000),
			Math.floor((Math.random()+Math.random())*1000),
			Math.floor((Math.random()+Math.random())*1000),
			Math.floor((Math.random()+Math.random())*1000),
			Math.floor((Math.random()+Math.random())*1000)
		]
		cdata={
			'原材料':{
				'num':Math.floor((Math.random()+Math.random())*1000),
				'process':((Math.random()+Math.random())*1000/100).toFixed(1)+'%',
				'icon':'ico1'
			},
			'油耗':{
				'num':Math.floor((Math.random()+Math.random())*1000),
				'process':((Math.random()+Math.random())*1000/100).toFixed(1)+'%',
				'icon':'ico2'
			},
			'辅料':{
				'num':Math.floor((Math.random()+Math.random())*1000),
				'process':((Math.random()+Math.random())*1000/100).toFixed(1)+'%',
				'icon':'ico3'
			},
			'司机提成':{
				'num':Math.floor((Math.random()+Math.random())*1000),
				'process':((Math.random()+Math.random())*1000/100).toFixed(1)+'%',
				'icon':'ico4'
			},
			'损耗':{
				'num':Math.floor((Math.random()+Math.random())*1000),
				'process':((Math.random()+Math.random())*1000/100).toFixed(1)+'%',
				'icon':'ico5'
			},
			'人工':{
				'num':Math.floor((Math.random()+Math.random())*1000),
				'process':((Math.random()+Math.random())*1000/100).toFixed(1)+'%',
				'icon':'ico6'
			},
			'电费':{
				'num':Math.floor((Math.random()+Math.random())*1000),
				'process':((Math.random()+Math.random())*1000/100).toFixed(1)+'%',
				'icon':'ico7'
			},
			'其他':{
				'num':Math.floor((Math.random()+Math.random())*1000),
				'process':((Math.random()+Math.random())*1000/100).toFixed(1)+'%',
				'icon':'ico8'
			}
		}
		$('.huafei').html('')
		for(var i in cdata){
			$('.huafei').append(`
				<li>
					<p>
						<span><img src="img/${cdata[i]['icon']}.png" alt=""></span>
						<span>${i}</span>
						<span>${cdata[i]['num']}元/${cdata[i]['process']}</span>
					</p>
				</li>
			`)
		}
	});
	
	myChart1.on('mouseout', function () {
		timeId3 && clearInterval(timeId3);
		timeId3 = setInterval(function () {
			myChart1.dispatchAction({
				type: 'downplay',
				seriesIndex: 0,
			});
			myChart1.dispatchAction({
				type: 'highlight',
				seriesIndex: 0,
				dataIndex: currentIndex
			});
			myChart1.dispatchAction({
				type: 'showTip',
				seriesIndex: 0,
				dataIndex: currentIndex
			});
			currentIndex = (currentIndex + 1) % dataLen;
			var data41=[
				{'name':'原材料','value':Math.floor((Math.random()+Math.random())*100)},
				{'name':'油耗','value':Math.floor((Math.random()+Math.random())*100)},
				{'name':'辅料','value':Math.floor((Math.random()+Math.random())*100)},
				{'name':'司机提成','value':Math.floor((Math.random()+Math.random())*100)},
				{'name':'损耗','value':Math.floor((Math.random()+Math.random())*100)},
				{'name':'人工','value':Math.floor((Math.random()+Math.random())*100)},
				{'name':'电费','value':Math.floor((Math.random()+Math.random())*100)},
				{'name':'其他','value':Math.floor((Math.random()+Math.random())*100)}
			]
			edata4.data=data41
			ech4(edata4)
			var data21=[
				{value: Math.floor((Math.random()+Math.random())*100), name: '水泥金额'},
				{value: Math.floor((Math.random()+Math.random())*100), name: '细骨料金额'},
				{value: Math.floor((Math.random()+Math.random())*100), name: '粗骨料金额'},
				{value: Math.floor((Math.random()+Math.random())*100), name: '水金额'},
				{value: Math.floor((Math.random()+Math.random())*100), name: '外加剂金额'},
				{value: Math.floor((Math.random()+Math.random())*100), name: '掺合料金额'},
				{value: Math.floor((Math.random()+Math.random())*100), name: '水泥金额1'},
				{value: Math.floor((Math.random()+Math.random())*100), name: '细骨料金额1'},
				{value: Math.floor((Math.random()+Math.random())*100), name: '粗骨料金额1'},
				{value: Math.floor((Math.random()+Math.random())*100), name: '水金额1'},
				{value: Math.floor((Math.random()+Math.random())*100), name: '外加剂金额1'},
				{value: Math.floor((Math.random()+Math.random())*100), name: '掺合料金额1'}
			]
			edata2.data=data21
			ech2(edata2)
			var datan=[
				Math.floor((Math.random()+Math.random())*1000),
				Math.floor((Math.random()+Math.random())*1000),
				Math.floor((Math.random()+Math.random())*1000),
				Math.floor((Math.random()+Math.random())*1000),
				Math.floor((Math.random()+Math.random())*1000),
				Math.floor((Math.random()+Math.random())*1000),
				Math.floor((Math.random()+Math.random())*1000),
				Math.floor((Math.random()+Math.random())*1000)
			]
			cdata={
				'原材料':{
					'num':Math.floor((Math.random()+Math.random())*1000),
					'process':((Math.random()+Math.random())*1000/100).toFixed(1)+'%',
					'icon':'ico1'
				},
				'油耗':{
					'num':Math.floor((Math.random()+Math.random())*1000),
					'process':((Math.random()+Math.random())*1000/100).toFixed(1)+'%',
					'icon':'ico2'
				},
				'辅料':{
					'num':Math.floor((Math.random()+Math.random())*1000),
					'process':((Math.random()+Math.random())*1000/100).toFixed(1)+'%',
					'icon':'ico3'
				},
				'司机提成':{
					'num':Math.floor((Math.random()+Math.random())*1000),
					'process':((Math.random()+Math.random())*1000/100).toFixed(1)+'%',
					'icon':'ico4'
				},
				'损耗':{
					'num':Math.floor((Math.random()+Math.random())*1000),
					'process':((Math.random()+Math.random())*1000/100).toFixed(1)+'%',
					'icon':'ico5'
				},
				'人工':{
					'num':Math.floor((Math.random()+Math.random())*1000),
					'process':((Math.random()+Math.random())*1000/100).toFixed(1)+'%',
					'icon':'ico6'
				},
				'电费':{
					'num':Math.floor((Math.random()+Math.random())*1000),
					'process':((Math.random()+Math.random())*1000/100).toFixed(1)+'%',
					'icon':'ico7'
				},
				'其他':{
					'num':Math.floor((Math.random()+Math.random())*1000),
					'process':((Math.random()+Math.random())*1000/100).toFixed(1)+'%',
					'icon':'ico8'
				}
			}
			$('.huafei').html('')
			for(var i in cdata){
				$('.huafei').append(`
					<li>
						<p>
							<span><img src="img/${cdata[i]['icon']}.png" alt=""></span>
							<span>${i}</span>
							<span>${cdata[i]['num']}元/${cdata[i]['process']}</span>
						</p>
					</li>
				`)
			}
		}, 2000);
	});
}
// 饼状图
var myChart2 = echarts.init(document.getElementById('echart2'));
function ech2(res){
var wd2=50
var ft2=14
var iw=22
var ih=10
if (window.screen.width < 1681) {
	wd2=42
	ft2=12
}
if (window.screen.width < 1401) {
	wd2=34
	ft2=10
	iw=16
	ih=8
}

option2 = {
    tooltip: {
        trigger: 'item',
        formatter: '{a} <br/>{b} : {c} ({d}%)'
    },
	color:res.col,
    legend: {
		left:'42.5%',
		top:"10%",
        data: res.names,
		itemWidth: iw,
		itemHeight: ih,
		formatter:  function(name){
			var target;
			for (var i = 0, l = res.names.length; i < l; i++) {
				if (res.names[i] == name) {
					target = option2['series']['data'][i]['value'];
				}
			}
			var arr = [
				'{b|'+name+':}',
				'{a|'+target+'}',
			]
			return arr.join('')
		},
		textStyle: {
			color:res.col,
			rich:{
				a:{
					verticalAlign:'top',
					align:'right',
					fontSize:ft2,
					width:wd2,
					padding:[0,30,5,0]
				},
				b:{
					fontSize:ft2,
					width:wd2,
					padding:[0,0,5,0]
				}
			}
		},
    },
    series: {
            name: '面积模式',
            type: 'pie',
            radius: [15, 70],
            center: ['21%', '50%'],
            roseType: 'area',
			labelLine: {
				normal: {
					length: 5,
				}
			},
			label: {
				normal: {
					formatter: ' {per|{b}{d}%}',
					align: 'center',	
					fontSize:12,
					rich: {
						per:{
							 backgroundColor: {
								 image: 'img/bg-e.png'
							 },
							 padding:[3, 5]
						}
					}
				}
			},
            data: res.data
        }
};
myChart2.setOption(option2,true);
myChart2.setOption(option2);
}


// 左侧折线图3
var myChart3 = echarts.init(document.getElementById('echart3'));
function ech3(res){
var series=[];
	 for(var i in res.data){
		series.push(
		{
		    name: i,
		    type: 'line',
			animation:true,
			symbol: 'circle',
			showSymbol: true,
			lineStyle:{
				color:res['data'][i]['col'],
			},
		    data:res['data'][i]['shuju']
		}
		)
	}
	option3 = {
	    tooltip: {
	        trigger: 'axis',
	        axisPointer: {
	            type: 'shadow',
	            label: {
	                backgroundColor: '#6a7985'
	            }
	        }
	    },
		dataZoom: [{
			type: 'inside',
			start: 0,
			end: 100
		},],
		color:res.col,
	    legend: {
			top:"3%",
	        data: res.names,
			textStyle:{
				color:'#fff',  //坐标的字体颜色
				fontSize:12
			},
			formatter: (params) => {  //格式化数据的函数
				for (let a = 0; a < option3.series.length; a++) {
					if (option3.series[a].name == params) {
						 var total=0
						 for(var num of option3.series[a].data){
							total+= num
						 }
						  return params
					}
				}
			}
	    },
	    grid: {
	        left: '1%',
	        right: '2%',
	        bottom: '3%',
	        containLabel: true
	    },
	    xAxis: [
	        {
	            type: 'category',
	            boundaryGap: false,
				axisLabel: {
					textStyle:{
						color:'#5fccff',  //坐标的字体颜色
					},
					formatter: '{value}'
				},
				splitLine:{
					 lineStyle: {
						 type: 'solid',
						 color: '#25315c'
					 }
				 },
	            data: res.datax
	        }
	    ],
	    yAxis: [
	        {
	            type: 'value',
				axisLabel: {
					textStyle:{
						color:'#5fccff',  //坐标的字体颜色
					}
				},
				splitLine:{
					 show: true,
					 lineStyle: {
						 type: 'solid',
						 color: '#25315c'
					}
				},
	        }
	    ],
	    series: series
	};
	myChart3.setOption(option3,true);
	myChart3.setOption(option3);
	lub1(myChart3,data31)
}

// tooltip自动轮播
var timeId2=null
var tab2=1
function lub1(myChart3,data31){	
	var currentIndex = -1;
	timeId2 && clearInterval(timeId2);
	var dataLen = data31.length;
	timeId2=setInterval(function () {
		// 取消之前高亮的图形
		myChart3.dispatchAction({
		  type: 'downplay',
		  seriesIndex: 0,
		  dataIndex: currentIndex
		});
		currentIndex = (currentIndex + 1) % dataLen;
		
		//console.log(app.currentIndex);
		// 高亮当前图形
		myChart3.dispatchAction({
		  type: 'highlight',
		  seriesIndex: 0,
		  dataIndex: currentIndex,
		});
		// 显示 tooltip
		myChart3.dispatchAction({
		  type: 'showTip',
		  seriesIndex: 0,
		  dataIndex: currentIndex
		});
		if(currentIndex+1==dataLen){
			currentIndex=-1
			$('.nav1 span').eq(tab2).siblings().removeClass('on')
			$('.nav1 span').eq(tab2).addClass('on')
			if(tab2==1){
				// 年总数
				tab2=0
				clearInterval(timeId2)
				ech3(edata31)
			}else{
				// 月总数
				clearInterval(timeId2)
				ech3(edata3)
				tab2++
			}
		}
	}, 2000);
	
	 myChart3.on('mouseover', function () {
		clearInterval(timeId2);
	});

	myChart3.on('mouseout', function () {
		timeId2 && clearInterval(timeId2);
		timeId2 = setInterval(function () {
			myChart3.dispatchAction({
				type: 'downplay',
				seriesIndex: 0,
			});
			myChart3.dispatchAction({
				type: 'highlight',
				seriesIndex: 0,
				dataIndex: currentIndex
			});
			myChart3.dispatchAction({
				type: 'showTip',
				seriesIndex: 0,
				dataIndex: currentIndex
			});
			currentIndex = (currentIndex + 1) % dataLen;
			if(currentIndex+1==dataLen){
				currentIndex=-1
				tab2++
				$('.nav1 span').eq(tab2).siblings().removeClass('on')
				$('.nav1 span').eq(tab2).addClass('on')
				if(tab2==1){
					// 年总数
					clearInterval(timeId2)
					ech3(edata31)
				}else{
					// 月总数
					clearInterval(timeId2)
					ech3(edata3)
				}
				if(tab2==1){
					tab2=0
				}
			}
		}, 2000);
	});
}

// 右上环形图
var myChart4 = echarts.init(document.getElementById('echart4'));
function ech4(res){
$('.fenlei').html('')
for(var i in res.fenlei){
	$('.fenlei').append(`
		<li>
			<p class="ziti">${res.fenlei[i]}</p>
			<p>${i}</p>
		</li>
	`)
}
option4 = {
    tooltip: {
        trigger: 'item',
        formatter: '{a} <br/>{b}: {c} ({d}%)'
    },
	title: {
		text: '{a|共计}\n'+res.total,
		y:'26%',
		x:'center',
		textStyle: {
			fontSize:30,
			fontWeight:'normal',
			color: ['#5fccff'],
			fontFamily: 'UNIDREAMLED',
			rich:{
				a:{
					fontSize:18,
					lineHeight:30
				}
			}
		}
	},
    legend: {
		bottom:"0%",
		left:"10%",
		itemWidth:16,
		itemHeight:8,
        data: res.names,
		formatter:  function(name){
			return '{c|'+name+'}'
		},
		textStyle: {
			color:res.col,
			fontSize: 14,
			rich:{
				c:{
					width:50
				}
			}
		}
    },
	color:res.col,
    series: [
        {
            name: '',
            type: 'pie',
            radius: ['45%', '60%'],
			center:['50%','43%'],
			startAngle:270,
            avoidLabelOverlap: false,
            labelLine: {
            	normal: {
            		length: 15,
            		length2: 40
            	}	 
            },
            label: {
            	normal: {
            		formatter: '{d}%\n',
            		fontSize:18,
            		padding: [0, -40],
					fontFamily: 'UNIDREAMLED',
            	}
            },
            data: res.data,
            itemStyle:{
                borderWidth:4,
                borderColor:"#0c1948"
				
            }
        }
    ]
};
myChart4.setOption(option4,true);
myChart4.setOption(option4);
}